module.exports = (app) => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;

  const ForwarTaskdSchema = new Schema(
    {
      ownerWxid: { type: String, required: true, index: true }, // 发送方      
      wxid: { type: String, required: true }, // 接收方
      msgtype: { type: String, required: true },
      message: { type: String, required: true },
      status: { type: Number, default: 0 }, // 发送状态 0 未发 1已发 2失败
    },
    {
      timestamps: { createdAt: "createTime", updatedAt: "updateTime" },
    }
  );

  // 索引建议（提高查询效率）
  ForwarTaskdSchema.index({ ownerWxid: 1 });
  ForwarTaskdSchema.index({ wxid: 1 });
  ForwarTaskdSchema.index({ status: 1 });

  return mongoose.model("Forwardtask", ForwarTaskdSchema, "forwardtask");
};
